CFLAGS = -Wall -fpic -coverage -lm
all: playdom cardTests unitTests runtests

#assignment3: cardTests unitTests

#assignment3.o: Assignment3.c
#	gcc -o assignment3 -g Assignment3.c dominion.o rngs.o $(CFLAGS)

randomtestadventurer: randomtestadventurer.c dominion.o rngs.o
	gcc -o randomtestadventurer -g randomtestadventurer.c dominion.o rngs.o $(CFLAGS)

randomtestcard: randomtestcard.c  dominion.o rngs.o
	gcc -o randomtestcard -g randomtestcard.c dominion.o rngs.o $(CFLAGS)
	
Homework4: randomtestadventurer randomtestcard
	./randomtestadventurer &> randomtestadventurer.out
	./randomtestcard &> randomtestcard.out

cardTests: cardtest1 cardtest2 cardtest3 cardtest4

unitTests: unitTest1 unitTest2 unitTest3 unitTest4

cardtest1: cardtest1.c  dominion.o rngs.o
	gcc -o cardtest1 -g cardtest1.c dominion.o rngs.o $(CFLAGS)
	
cardtest2: cardtest2.c  dominion.o rngs.o
	gcc -o cardtest2 -g cardtest2.c dominion.o rngs.o $(CFLAGS)
	
cardtest3: cardtest3.c  dominion.o rngs.o
	gcc -o cardtest3 -g cardtest3.c dominion.o rngs.o $(CFLAGS)
	
cardtest4: cardtest4.c  dominion.o rngs.o
	gcc -o cardtest4 -g cardtest4.c dominion.o rngs.o $(CFLAGS)

unitTest1: unittest1.c  dominion.o rngs.o
	gcc -o unitTest1 -g unittest1.c dominion.o rngs.o $(CFLAGS)

unitTest2: unittest2.c  dominion.o rngs.o
	gcc -o unitTest2 -g unittest2.c dominion.o rngs.o $(CFLAGS)

unitTest3: unittest3.c  dominion.o rngs.o
	gcc -o unitTest3 -g unittest3.c dominion.o rngs.o $(CFLAGS)

unitTest4: unittest4.c  dominion.o rngs.o
	gcc -o unitTest4 -g unittest4.c dominion.o rngs.o $(CFLAGS)

rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)

testDrawCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

badTestDrawCard: badTestDrawCard.c dominion.o rngs.o
	gcc -o badTestDrawCard -g  badTestDrawCard.c dominion.o rngs.o $(CFLAGS)

testBuyCard: testDrawCard.c dominion.o rngs.o
	gcc -o testDrawCard -g  testDrawCard.c dominion.o rngs.o $(CFLAGS)

testAll: dominion.o testSuite.c
	gcc -o testSuite testSuite.c -g  dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

runUnitTests: unitTest1 unitTest2 unitTest3 unitTest4
	./unitTest1 &> unittestresult.out
	./unitTest2 >> unittestresult.out
	./unitTest3 >> unittestresult.out
	./unitTest4 >> unittestresult.out
	
	#gcov dominion.c >> unittestresult.out
	#cat dominion.c.gcov >> unittestresult.out

runCardTests: cardtest1 cardtest2 cardtest3 cardtest4
	./cardtest1 &> cardTestResult.out
	./cardtest2 >> cardTestResult.out
	./cardtest3 >> cardTestResult.out
	./cardtest4 >> cardTestResult.out
	#gcov dominion.c >> cardTestResult.out
	#cat dominion.c.gcov >> cardTestResult.out

runRandomTests: randomtestadventurer randomtestcard
	./randomtestadventurer &> randTestResult.out
	./randomtestcard >> randTestResult.out
	#gcov dominion.c >> randTestResult.out
	#cat dominion.c.gcov >> randTestResult.out

runAllTests: runUnitTests runCardTests runRandomTests
	runUnitTests 
	runCardTests 
	runRandomTests

player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

all: playdom player testDrawCard testBuyCard badTestDrawCard

clean:
	rm -f *.o playdom.exe playdom test.exe test player player.exe testInit testInit.exe *.gcov *.gcda *.gcno *.so
